using UnityEngine;

public class ConfigParams : MonoBehaviour
{
	public static float camDistance = 4f;

	public static float camAngleVertical = 22f;

	public static float swipeForce = 1f;

	public static float ballMass = 5f;

	public static float touchSensitivity = 1.5f;

	public static float forcePower = 3f;

	public static float torquePower = 1f;

	public static float gesturePower = 1f;

	public static float forcePowerAir = 3f;

	public static float torquePowerAir = 1f;

	public static float forcePowerSlippery = 0.25f;

	public static float torquePowerSlippery = 1.5f;

	public static bool applyTorque;

	public static bool applyForce = true;

	public static bool applyGesturePower;

	public static float gravity = -9.81f;

	public static float ballDrag = 0.2f;

	private void Start()
	{
		ballMass = 5f;
		camDistance = 4f;
		camAngleVertical = 20f;
		forcePower = 3.5f;
		torquePower = UserPrefs.getFloat("torquePower", torquePower);
		forcePowerAir = 0.4f;
		torquePowerAir = 0.3f;
		gesturePower = UserPrefs.getFloat("gesturePower", gesturePower);
		applyTorque = UserPrefs.getBool("applyTorque", applyTorque);
		applyForce = UserPrefs.getBool("applyForce", applyForce);
		applyForce = UserPrefs.getBool("applyGesturePower", applyGesturePower);
		gravity = -9.81f;
		ballDrag = 0.1f;
	}

	private void SaveValues()
	{
		UserPrefs.setFloat("ballMass", ballMass);
		UserPrefs.setFloat("camDistance", camDistance);
		UserPrefs.setFloat("camAngleVertical", camAngleVertical);
		UserPrefs.setFloat("forcePower", forcePower);
		UserPrefs.setFloat("torquePower", torquePower);
		UserPrefs.setFloat("forcePowerAir", forcePowerAir);
		UserPrefs.setFloat("torquePowerAir", torquePowerAir);
		UserPrefs.setFloat("gesturePower", gesturePower);
		UserPrefs.setBool("applyTorque", applyTorque);
		UserPrefs.setBool("applyForce", applyForce);
		UserPrefs.setBool("applyGesturePower", applyGesturePower);
		UserPrefs.setFloat("gravity", gravity);
		UserPrefs.setFloat("ballDrag", ballDrag);
	}

	private void OnApplicationPause(bool pauseStatus)
	{
		if (pauseStatus)
		{
			SaveValues();
		}
	}

	private void FloatControls(Vector2 pos, string label, float currentValue, float step, out float targetVar)
	{
		float num = currentValue;
		float num2 = 40f;
		float num3 = 100f;
		float num4 = 60f;
		GUIStyle style = GUI.skin.GetStyle("Label");
		style.alignment = TextAnchor.MiddleRight;
		GUI.Label(new Rect(pos.x, pos.y, num3, num2), label, style);
		if (GUI.Button(new Rect(pos.x + num3, pos.y, num2, num2), "-"))
		{
			num -= step;
			SaveValues();
		}
		if (GUI.Button(new Rect(pos.x + num3 + num2 + num4, pos.y, num2, num2), "+"))
		{
			num += step;
			SaveValues();
		}
		GUIStyle style2 = GUI.skin.GetStyle("Label");
		style2.alignment = TextAnchor.MiddleCenter;
		GUI.Label(new Rect(pos.x + num3 + num2, pos.y, num4, num2), currentValue.ToString("f2"), style2);
		targetVar = num;
	}

	private void BoolControls(Vector2 pos, string label, bool currentValue, out bool targetVar)
	{
		bool flag = currentValue;
		float height = 20f;
		float width = 180f;
		if (GUI.Button(new Rect(pos.x, pos.y, width, height), label + currentValue))
		{
			flag = !flag;
			SaveValues();
		}
		targetVar = flag;
	}
}
